<template>
  <div id="app">
		<div v-show="loading"  class="loadingBg">
			<van-loading  size="24px" color="#1989fa" vertical>加载中...</van-loading>
		</div>

		<!-- 修改 keep-alive，确保 storejieshu 不被缓存 -->
		<keep-alive :include="cachedPages">
			<router-view v-if="$route.meta.keepAlive"></router-view>
		</keep-alive>

		<router-view v-if="!$route.meta.keepAlive"></router-view>

		<van-tabbar route v-show="$route.meta.showBottomTabBar">
		  <van-tabbar-item replace to="/main" 		icon="sign">收货</van-tabbar-item>
		  <van-tabbar-item replace to="/jianhuo" 	icon="logistics">拣货</van-tabbar-item>
		  <van-tabbar-item replace to="/pandian" 	icon="send-gift-o">盘点</van-tabbar-item>
		  <van-tabbar-item replace to="/search" 	icon="search">查询</van-tabbar-item>
		</van-tabbar>

  </div>
</template>

<script>
import { mapActions,mapState} from "vuex";
export default {
  name: 'App',
  provide() {
    return {
      reload: this.reload
    }
  },
  data() {
    return {
      isRouterAlive: true
    };
  },
	computed: {
    ...mapState(['loading']),
    ...mapState(['cacheEnabled']),
    cachedPages() {
      // 打印用于调试
      const cached = this.$router.getRoutes()
        .filter(route => route.meta.keepAlive)
        .map(route => route.name);
      // console.log('需要缓存的页面：', cached);
      return cached;
    }
	},
  methods: {
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(() => {
        this.isRouterAlive = true;
      })
    }
  },
	components: {

	},
  mounted() {
    //console.log("-- 可能需要处理功能权限 --");
    var _self = this; var l_hy = this.GWO(true).gUSER;  window.GWO().debug=this;

  },
};
</script>




<style lang="scss">
// 引入公共样式
@import '@/assets/css/global.scss';
/* 全局样式表 */
html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #F5F8FA;
}
.loadingBg{
  position: fixed !important;
	z-index: 9999;
	background-color: rgba(0, 0, 0, 0.7);
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
}
</style>
